package org.example.demoarticle.Mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.demoarticle.pojo.User;
import org.springframework.stereotype.Repository;

@Mapper
public interface UserMapper {

    @Select("select* from user where username=#{username} and password=#{password}")
    User gerByUserNameAndPassword(User user);

    @Select("select* from user where username=#{username}")
    User getByName(String username);

    @Select("select type_name from user_type where id=(select type_id from user where username=#{username})")
    String getType(String username);

    @Update("update user set password=#{newPassword} where username=#{username}")
    int updatePassword(String username, String newPassword);
}
